package com.ruoyi.whzj.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.IdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.whzj.mapper.WhAskquestionMapper;
import com.ruoyi.whzj.domain.WhAskquestion;
import com.ruoyi.whzj.service.IWhAskquestionService;
import com.ruoyi.common.core.text.Convert;

/**
 * 常见问答Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-10-29
 */
@Service
public class WhAskquestionServiceImpl implements IWhAskquestionService 
{
    @Autowired
    private WhAskquestionMapper whAskquestionMapper;

    /**
     * 查询常见问答
     * 
     * @param id 常见问答ID
     * @return 常见问答
     */
    @Override
    public WhAskquestion selectWhAskquestionById(String id)
    {
        return whAskquestionMapper.selectWhAskquestionById(id);
    }

    /**
     * 查询常见问答列表
     * 
     * @param whAskquestion 常见问答
     * @return 常见问答
     */
    @Override
    public List<WhAskquestion> selectWhAskquestionList(WhAskquestion whAskquestion)
    {
        return whAskquestionMapper.selectWhAskquestionList(whAskquestion);
    }

    /**
     * 新增常见问答
     * 
     * @param whAskquestion 常见问答
     * @return 结果
     */
    @Override
    public int insertWhAskquestion(WhAskquestion whAskquestion)
    {
        whAskquestion.setId(IdWorker.getId());
        whAskquestion.setCreateTime(DateUtils.getNowDate());
        return whAskquestionMapper.insertWhAskquestion(whAskquestion);
    }

    /**
     * 修改常见问答
     * 
     * @param whAskquestion 常见问答
     * @return 结果
     */
    @Override
    public int updateWhAskquestion(WhAskquestion whAskquestion)
    {
        whAskquestion.setUpdateTime(DateUtils.getNowDate());
        return whAskquestionMapper.updateWhAskquestion(whAskquestion);
    }

    /**
     * 删除常见问答对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteWhAskquestionByIds(String ids)
    {
        return whAskquestionMapper.deleteWhAskquestionByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除常见问答信息
     * 
     * @param id 常见问答ID
     * @return 结果
     */
    @Override
    public int deleteWhAskquestionById(String id)
    {
        return whAskquestionMapper.deleteWhAskquestionById(id);
    }
}
